<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 父组件 -->
    <div id="app">
        <h1>我是父组件</h1>
        <hr>
        <my-son></my-son>
    </div>
</body>
</html>
<script src="./js/vue.global.js"></script>
<script>
    // 定义子组件
    const MySon = {
        template: `
        <div>
            <h2>我是子组件</h2>
            <input type="button" value="传递给父组件">
            <p>sonMsg:{{sonMsg}}</p>
            </div>
        `,
        data() {
            return {
                sonMsg: "我是子组件"
            }
        }
    }

    const app = Vue.createApp({
        data() {
            return {
                components: { MySon }
            }
        }
    })
    app.mount("#app")
</script>